package com.example.adapter;

import java.util.List;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class MyBaseAdapter extends BaseAdapter
{
	public List list;
	public ScrollFootListener listener;
	public boolean isShowProgress;
	
	@Override
	public int getCount()
	{
		if (isShowProgress)
		{
			return list.size() + 1;
		}
		return list.size();
	}
	@Override
	public Object getItem(int position)
	{
		return list.get(position);
	}
	@Override
	public long getItemId(int position)
	{
		return position;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		return null;
	}
	public ScrollFootListener getScrollFootListener()
	{
		return listener;
	}
	public void setScrollFootListener(ScrollFootListener listener)
	{
		this.listener = listener;
	}
	public void clear()
	{
		this.list.clear();
	}
	public void addAll(List data)
	{
		if (data != null)
		{
			list.addAll(data);
		}
		this.notifyDataSetChanged();
	}
	public void showprogress()
	{
		isShowProgress = true;
		this.notifyDataSetChanged();
	}
	public void hideprogress()
	{
		isShowProgress = false;
		this.notifyDataSetChanged();
	}
}
